package test.didi;

import java.util.*;

/**
 * @description: 滴滴笔试 第一天A72 第二题 A82
 * @author: w_jingbo
 * @date: 2023/9/8
 * @Copyright: 博客：http://coisini.wang
 */
public class Main {



    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = Integer.parseInt(in.nextLine());
        PriorityQueue<String> res = new PriorityQueue<>((o1, o2) -> o1.compareTo(o2)) ;
        List<String> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            list.add(in.nextLine());
        }
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                String s1 = list.get(i) + list.get(j) ;
                String s2 = list.get(j) + list.get(i) ;

                for(int k = 0 ; k < n ; k++){
                    if(k == i || k == j){
                        continue;
                    }
                    String str = list.get(k) ;
                    String res1 = isContains(s1,str) ;
                    String res2 = isContains(s2,str) ;
                    if(res1 != null && !res.contains(res1)){
                        res.add(res1);
                    }
                    if(res2 != null && !res.contains(res2)){
                        res.add(res2);
                    }
                }
            }
        }
        System.out.println(res.size());
        while (!res.isEmpty()){
            System.out.println(res.poll());
        }



    }

    public static String isContains(String str1 , String str2){
        if(str1.length() < str2.length()){
            return null ;
        }
        int j = 0 ;
        for (int i = 0; i < str1.length() ; i++) {
            if(str1.charAt(i) != str2.charAt(j)){
                j = 0 ;
            }else {
                j++ ;
                if(j == str2.length()){
                    return str2 ;
                }
            }

        }
        return null ;
    }
}


/*


String[] s = in.nextLine().split(" ");
        int n = Integer.parseInt(s[0]) ;
        int res = 0 ;
        int a = Integer.parseInt(s[1]) ;
        int b = Integer.parseInt(s[2]) ;
        String[] s1 = in.nextLine().split(" ");
        int[] arr = new int[s1.length] ;
        for(int i = 0 ; i < s1.length ; i++){
            arr[i] = Integer.parseInt(s1[i]);
        }
        for(int j = 1 ; j < 100000; j++){
            int a1 = 0;
            for(int i = 0 ; i < n ; i++){
                a1 += ( j * arr[i] ) / b ;
            }
            if(a1 >= a){
                System.out.println(j) ;
                break;
            }
        }


 */
